import http from "@/api";

import { ResPage } from "@/api/interface";

import { JobEntity, JobManagerVo } from "@/biz/interface/JobType";

import { ModuleMainUrl } from "..";

const moduleUrl = ModuleMainUrl;

// * 获取工作列表
export const getJobVoListApi = (params: {}) => {
  return http.post<ResPage<JobManagerVo>>(moduleUrl + `/job/jobrpvolist`, params);
};

// * 获取工作列表
export const getOddJobVoListApi = (params: {}) => {
  return http.post<ResPage<JobManagerVo>>(moduleUrl + `/job/oddjobrpvolist`, params);
};

// * 获取考证列表
export const getTrainVoListApi = (params: {}) => {
  return http.post<ResPage<JobManagerVo>>(moduleUrl + `/job/trainrpvolist`, params);
};

// * 获取工作列表
export const getJobinlineVoListApi = (params: {}) => {
  return http.post<ResPage<JobManagerVo>>(moduleUrl + `/job/sysjobvolist`, params);
};

// * 新增工作接口
export const saveJobApi = (job: JobEntity) => {
  return http.post(moduleUrl + `/job/jobsave`, job);
};

// * 新增工作接口
export const saveJobInlineApi = (job: JobEntity) => {
  return http.post(moduleUrl + `/job/sysjobsave`, job);
};

// * 新增全职岗位接口
export const savePostApi = (post: JobEntity) => {
  return http.post(moduleUrl + `/cpyjob/ftsave`, post);
};

// * 详情工作接口
export const getJobInfoApi = (params: { id: string }) => {
  return http.post<JobEntity>(moduleUrl + `/job/jobinfo`, params);
};

// * 删除工作接口
export const deleteJobApi = (params: { id: string }) => {
  return http.post(moduleUrl + `/job/jobdelete`, params);
};

// * 修改工作状态接口
export const changeFlagActiveApi = (params: { id: string }) => {
  return http.post(moduleUrl + `/job/jobactive`, params);
};

// * 发布的岗位审核通过
export const auditPassApi = (params: { id: string }) => {
  return http.post(moduleUrl + `/job/jobauditp`, params);
};

// * 发布的岗位审核不通过
export const auditFailApi = (params: { id: string; refuseCtn: string }) => {
  return http.post(moduleUrl + `/job/jobauditf`, params);
};

// * 获取下一个要审核的全职岗位
export const getNextJobApi = (params: { id: string }) => {
  return http.post(moduleUrl + `/job/jobrpnextitem`, params);
};

// * 岗位统计量
export const saveJobCntApi = (params: {}) => {
  return http.post(moduleUrl + `/job/jobcntsave`, params);
};

// * 岗位统计量
export const getJobCntInfoApi = (params: { jobId: string }) => {
  return http.post(moduleUrl + `/job/jobcntinfo`, params);
};
